﻿using System;
using System.Collections.Generic;
using System.Data.Linq;
using SecurityLog.Models;

namespace SecurityLog.Biz
{
    public class Users
    {
        private readonly string _name;
        private readonly string _initials;
        private readonly List<Object> _list;
        private bool _hasEntries;

        public Users(string name, string initials)
        {
            _name = name;
            _initials = initials;
        }

        public Users(string name, string initials, bool hasEntries)
            : this(name, initials)
        {
            _hasEntries = hasEntries;
        }

        public bool HasEntries
        {
            get { return _hasEntries; }
        }

        public bool ValidateUserData()
        {
            if (String.IsNullOrEmpty(_name))
                return false;

            if (String.IsNullOrEmpty(_initials) || _initials.Length < 2 || _initials.Length > 5)
                return false;

            return true;
        }

        /*
        public bool CanDeleteUser(UsersRepository usersRepository, int userId)
        {
            Models.User u = usersRepository.GetUserById(userId);
            if (u != null)
            {
                if (u.Entries == null || u.Entries.Count == 0)
                    return true;
            }

            return false;
        }*/
    }
}